home *** CD-ROM | disk | FTP | other *** search
- property spriteNum, pMyAngle, h, v, pBalloonDirection, pBalloonSpeed, pLocH, pLocV, pBalloonDistance, pBalloonRotation, pWait4Step, pBalloonAlive, pBlendUp, pBlendDown, pFrame, pLightingH, pLightingV, pTemp, pBlink, pTimePop
- global gLevel, gShocked, gLifePoints, gPaused, secs, mins
-
- on beginSprite me
- pTemp = 1
- pBlink = 25
- pTimePop = 0
- pLightingH = 0
- pLightingV = 0
- pFrame = 1
- pBalloonAlive = 1
- pLocH = sprite(spriteNum).locH
- pLocV = sprite(spriteNum).locV
- sprite(spriteNum).blend = 100
- pBalloonSpeed = 0
- pBalloonDirection = 0.0
- pBalloonDistance = 0.0
- pBalloonRotation = 0.0
- startTimer()
- end
-
- on exitFrame me
- if pBalloonAlive = 1 then
- pBalloonDistance = getDistance(sprite(spriteNum).locH, sprite(spriteNum).locV, mouseH(), mouseV())
- if pBalloonDistance > 160 then
- pBalloonSpeed = 0.5
- pBalloonDirection = getAngle(sprite(spriteNum).locH, sprite(spriteNum).locV, mouseH(), mouseV())
- else
- pBalloonDistance = getDistance(sprite(spriteNum).locH, sprite(spriteNum).locV, mouseH(), mouseV())
- pBalloonSpeed = (180 - pBalloonDistance) / 40.0
- pBalloonDirection = getAngle(sprite(spriteNum).locH, sprite(spriteNum).locV, mouseH(), mouseV())
- end if
- pBalloonRotation = 360 - getAngle(mouseH(), mouseV(), sprite(spriteNum).locH, sprite(spriteNum).locV)
- sprite(spriteNum).rotation = pBalloonRotation
- Shocked()
- BalloonMove()
- AnimateBalloon()
- Check4Win()
- end if
- end
-
- on BalloonMove
- pMyAngle = pBalloonDirection * PI / 180.0
- h = sin(pMyAngle) * pBalloonSpeed
- v = cos(pMyAngle) * pBalloonSpeed
- pLocH = pLocH + h
- pLocV = pLocV + v
- sprite(15).loc = point(pLocH, pLocV)
- updateStage()
- ObjectCollision()
- sprite(spriteNum).loc = point(pLocH, pLocV)
- sprite(19).loc = point(pLocH + pLightingH, pLocV + pLightingV)
- end
-
- on Shocked
- if gShocked = 1 then
- if gLifePoints <= 0 then
- pBalloonAlive = 0
- gPaused = 1
- member("gameOverText").text = "Give it another try!"
- if secs < 10 then
- member("TimeLeftText").text = "Elapsed Time:" && string(mins) & ":0" & string(secs)
- else
- member("TimeLeftText").text = "Elapsed Time:" && string(mins) & ":" & string(secs)
- end if
- if soundBusy(5) then
- sound(5).stop()
- end if
- puppetSound(6, "gameoverSound")
- cursor(-1)
- go(20)
- end if
- if pTimePop < the timer then
- sprite(spriteNum).blend = 100
- sprite(19).blend = 100
- pBlink = pBlink - 1
- pTimePop = the timer + pBlink
- else
- sprite(spriteNum).blend = 40
- sprite(19).blend = 40
- end if
- if pBlink <= 0 then
- gShocked = 0
- sprite(spriteNum).blend = 100
- sprite(19).blend = 100
- end if
- end if
- end
-
- on AnimateBalloon
- if (pBalloonDistance < 160) and (pBalloonDistance >= 145) then
- if sprite(spriteNum).member.name <> "Balloon0009" then
- sprite(spriteNum).member = "Balloon0009"
- sound(5).volume = 30
- end if
- else
- if (pBalloonDistance < 145) and (pBalloonDistance >= 130) then
- if sprite(spriteNum).member.name <> "Balloon0008" then
- sprite(spriteNum).member = "Balloon0008"
- sound(5).volume = 55
- end if
- else
- if (pBalloonDistance < 130) and (pBalloonDistance >= 115) then
- if sprite(spriteNum).member.name <> "Balloon0007" then
- sprite(spriteNum).member = "Balloon0007"
- sound(5).volume = 80
- end if
- else
- if (pBalloonDistance < 115) and (pBalloonDistance >= 100) then
- if sprite(spriteNum).member.name <> "Balloon0006" then
- sprite(spriteNum).member = "Balloon0006"
- sound(5).volume = 105
- end if
- else
- if (pBalloonDistance < 100) and (pBalloonDistance >= 85) then
- if sprite(spriteNum).member.name <> "Balloon0005" then
- sprite(spriteNum).member = "Balloon0005"
- sound(5).volume = 130
- end if
- else
- if (pBalloonDistance < 85) and (pBalloonDistance >= 70) then
- if sprite(spriteNum).member.name <> "Balloon0004" then
- sprite(spriteNum).member = "Balloon0004"
- sound(5).volume = 155
- end if
- else
- if (pBalloonDistance < 70) and (pBalloonDistance >= 55) then
- if sprite(spriteNum).member.name <> "Balloon0003" then
- sprite(spriteNum).member = "Balloon0003"
- sound(5).volume = 180
- end if
- else
- if (pBalloonDistance < 55) and (pBalloonDistance >= 40) then
- if sprite(spriteNum).member.name <> "Balloon0002" then
- sprite(spriteNum).member = "Balloon0002"
- sound(5).volume = 205
- end if
- else
- if (pBalloonDistance < 40) and (pBalloonDistance >= 25) then
- if sprite(spriteNum).member.name <> "Balloon0001" then
- sprite(spriteNum).member = "Balloon0001"
- sound(5).volume = 230
- end if
- else
- if pBalloonDistance < 25 then
- if sprite(spriteNum).member.name <> "Balloon0000" then
- sprite(spriteNum).member = "Balloon0000"
- sound(5).volume = 255
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- if sprite(spriteNum).locV <= 55 then
- if pLightingV <> 4 then
- pLightingV = 4
- end if
- else
- if (sprite(spriteNum).locV > 55) and (sprite(spriteNum).locV <= 110) then
- if pLightingV <> 3 then
- pLightingV = 3
- end if
- else
- if (sprite(spriteNum).locV > 110) and (sprite(spriteNum).locV <= 165) then
- if pLightingV <> 2 then
- pLightingV = 2
- end if
- else
- if (sprite(spriteNum).locV > 165) and (sprite(spriteNum).locV <= 220) then
- if pLightingV <> 1 then
- pLightingV = 1
- end if
- else
- if (sprite(spriteNum).locV > 220) and (sprite(spriteNum).locV <= 275) then
- if pLightingV <> 0 then
- pLightingV = 0
- end if
- else
- if (sprite(spriteNum).locV > 275) and (sprite(spriteNum).locV <= 335) then
- if pLightingV <> -1 then
- pLightingV = -1
- end if
- else
- if (sprite(spriteNum).locV > 335) and (sprite(spriteNum).locV <= 400) then
- if pLightingV <> -2 then
- pLightingV = -2
- end if
- else
- if sprite(spriteNum).locV > 400 then
- if pLightingV <> -3 then
- pLightingV = -3
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- if sprite(spriteNum).locH <= 90 then
- if pLightingH <> 3 then
- pLightingH = 3
- end if
- else
- if (sprite(spriteNum).locH > 90) and (sprite(spriteNum).locH <= 170) then
- if pLightingH <> 2 then
- pLightingH = 2
- end if
- else
- if (sprite(spriteNum).locH > 170) and (sprite(spriteNum).locH <= 250) then
- if pLightingH <> 1 then
- pLightingH = 1
- end if
- else
- if (sprite(spriteNum).locH > 250) and (sprite(spriteNum).locH <= 330) then
- if pLightingH <> 0 then
- pLightingH = 0
- end if
- else
- if (sprite(spriteNum).locH > 330) and (sprite(spriteNum).locH <= 410) then
- if pLightingH <> -1 then
- pLightingH = -1
- end if
- else
- if (sprite(spriteNum).locH > 410) and (sprite(spriteNum).locH <= 490) then
- if pLightingH <> -2 then
- pLightingH = -2
- end if
- else
- if sprite(spriteNum).locH > 490 then
- if pLightingH <> -3 then
- pLightingH = -3
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end
-
- on ObjectCollision
- if sprite(15).intersects(1) then
- pLocH = pLocH - h
- pLocV = pLocV - v
- if gShocked = 0 then
- puppetSound(1, "pop")
- sprite(spriteNum).blend = 40
- gShocked = 1
- pBlink = 25
- gLifePoints = gLifePoints - 1
- sprite(44 + gLifePoints).visible = 0
- end if
- else
- if sprite(15).intersects(35) or sprite(15).intersects(36) then
- if gShocked = 0 then
- puppetSound(1, "pop")
- pLocH = pLocH - h
- pLocV = pLocV - v
- sprite(spriteNum).blend = 40
- gShocked = 1
- pBlink = 25
- gLifePoints = gLifePoints - 1
- sprite(44 + gLifePoints).visible = 0
- end if
- else
- if sprite(15).intersects(22) or sprite(15).intersects(23) or sprite(15).intersects(24) or sprite(15).intersects(25) then
- pLocH = pLocH - h
- pLocV = pLocV - v
- end if
- end if
- end if
- end
-
- on Check4Win
- if (sprite(spriteNum).locH > 565) and (sprite(spriteNum).locV > 345) then
- member("gameOverText").text = "You Win!!!"
- pBalloonAlive = 0
- gPaused = 1
- if secs < 10 then
- member("TimeLeftText").text = "Elapsed Time:" && string(mins) & ":0" & string(secs)
- else
- member("TimeLeftText").text = "Elapsed Time:" && string(mins) & ":" & string(secs)
- end if
- cursor(-1)
- if soundBusy(5) then
- sound(5).stop()
- end if
- puppetSound(6, "youwin")
- go(20)
- end if
- end
-